<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.css" rel="stylesheet" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">提交报工单</h1>
		</header>
		<div class="mui-content" style="margin-top: 18px;">
			<div style="padding-top: 10px;">
				<span style="margin-left: 10px;">项目代码：</span>
				<input id="engineCode" disabled/>
			</div>
			<div style="padding-top: 10px;">
				<span style="margin-left: 10px;">项目名称：</span>
				<input id="engineName" disabled/>
			</div>
			<div style="padding-top: 10px;">
				<span style="margin-left: 10px;">工序代码：</span>
				<input id="procCode" disabled/>
			</div>
			<div style="padding-top: 10px;">
				<span style="margin-left: 10px;">工序名称：</span>
				<input id="procName" disabled/>
			</div>
			<div style="padding-top: 10px;">
				<span style="margin-left: 10px;">任务单号：</span>
				<input id="taskNo" disabled/>
			</div>
			<div style="padding-top: 10px;">
				<span style="margin-left: 10px;">任务数量：</span>
				<input id="taskCount" disabled/>
			</div>
			<div style="padding-top: 10px;">
				<span style="margin-left: 10px;">已报数量：</span>
				<input id="reportCount" disabled/>
			</div>
			<div style="padding-top: 10px;">
				<nobr>
					<span style="margin-left: 10px;">报工数量：</span>
					<input type="number" id="count" style="width: 240px;"/>
				</nobr>
			</div>
			<div style="padding-top: 10px;">
				<button class="mui-btn-success" type="button" style="width: 92%; font-size: 20px; margin: 10px;" onclick="subReorting()">提交报工单</button>
			</div>
		</div>
	</body>

	<script src="js/mui.min.js"></script>
	<script src="js/jquery.min.js"></script>
	<script src="js/common.js"></script>
	<script type="text/javascript">
		var sData;
		mui.init();
		$(function(){
			alert('000000000000');
			// taskNo,engineCode,engineName,procCode,procName,taskCount,reportCount
			$('#taskNo').val($_GET['taskNo']);
			$('#engineCode').val($_GET['engineCode']);
			$('#engineName').val($_GET['engineName']);
			$('#procCode').val($_GET['procCode']);
			$('#procName').val($_GET['procName']);
			$('#taskCount').val($_GET['taskCount']);
			$('#reportCount').val($_GET['reportCount']);
		});
		function subReorting(){
			var taskCount = $('#taskCount').val();
			var reportCount = $('#reportCount').val();
			var count = $('#count').val();
			if(count === undefined || count === ''){
				mui.toast("请输入报工数量！");
				return;
			}
			if(parseInt(count) <= 0){
				mui.toast("您输入正确的报工数量！");
				return;
			}
			if(parseInt(taskCount)-parseInt(reportCount) < parseInt(count)){
				mui.toast("您输入的报工数量大于未报工数量！");
				return;
			}
			$.ajax('http://192.168.1.192:8080/jeecg-boot/reporting/reporting/report',{
				headers:{
					"X-Access-Token":getCookie("token")
				},
				data:{'taskId':sData.taskId,'reportCount':parseInt(count)},
				type:'post',
				timeout:100000,
				success:function(data){
					var wobj = plus.webview.getWebviewById("task.html");
					wobj.reload(true);
				},
				error:function(xhr,type,errorThrown){
					alert("errorThrown");
				}
			})
		}
	</script>
</html>
